home *** CD-ROM | disk | FTP | other *** search
/ Kit PC World De Ampliacion De Windows 95 / Kit PC World de ampliacion de Windows 95.iso / clarion / cw15 / tpw15.z / GPPROCES.TPW < prev    next >
Text File  |  1995-08-24  |  4KB  |  124 lines

  1. #!--------------------------------------------
  2. #GROUP(%ProcessDeclarations)
  3. #EMBED(%DeclarationSection,'Declaration Section'),DATA
  4.   #FOR(%LocalData)
  5. %[20]LocalData %LocalDataStatement
  6.   #ENDFOR
  7. !-----------------------------------------------------------------------------
  8. #GROUP(%ProcessEndOfProcedure)
  9. #IF(%EnableQuickScan)
  10. #EMBED(%BeforeTurnQuickScanOff,'Before Turning QuickScan Off'),WHERE(%EnableQuickScan)
  11. IF SEND(%Primary,'QUICKSCAN=off').
  12. #FOR(%Secondary),WHERE(%SecondaryType = '1:MANY')
  13. IF SEND(%Secondary,'QUICKSCAN=off').
  14. #ENDFOR
  15. #EMBED(%AfterTurnQuickScanOff,'After Turning QuickScan Off'),WHERE(%EnableQuickScan)
  16. #ENDIF
  17. #!---------------------------------------------------
  18. #GROUP(%ProcessSaveLimits),AUTO
  19. #EMBED(%WindowEventOpenWindowBefore,'Window Event: Open Window, before setting up for reading')
  20. #EMBED(%BeforeKeySet,'Before SET() issued')
  21.   #IF(%PrimaryKey)
  22. SET(%PrimaryKey)
  23.   #ELSE
  24. SET(%Primary)
  25.   #ENDIF
  26.   #IF (%ProcessFilter)
  27. %ListView{Prop:Filter} = '%ProcessFilter'
  28.   #ENDIF
  29. OPEN(%ListView)
  30. #EMBED(%BeforeInitialGet,'Before first record retrieval')
  31. LOOP
  32.   DO GetNextRecord
  33.   DO ValidateRecord
  34.   CASE RecordStatus
  35.     OF Record:Ok
  36.       BREAK
  37.     OF Record:OutOfRange
  38.       LocalResponse = RequestCancelled
  39.       BREAK
  40.   END
  41. END
  42. IF LocalResponse = RequestCancelled
  43.   POST(Event:CloseWindow)
  44.   CYCLE
  45. END
  46. #EMBED(%AfterInitialGet,'After first record retrieval')
  47. #EMBED(%WindowEventOpenWindowAfter,'Window Event: Open Window, after setting up for read')
  48. #!---------------------------------------------------
  49. #GROUP(%ProcessGetRecords)
  50. GetNextRecord ROUTINE
  51.   #EMBED(%TopOfGetNextRecord,'Top of GetNextRecord ROUTINE')
  52.   NEXT(%ListView)
  53.   #EMBED(%GetNextRecordAfterNext,'GetNextRecord ROUTINE, after NEXT')
  54.   IF ERRORCODE()
  55.     IF ERRORCODE() <> BadRecErr
  56.       StandardWarning(Warn:RecordFetchError,'%File')
  57.     END
  58.     LocalResponse = RequestCancelled
  59.     #EMBED(%GetNextRecordNextFails,'GetNextRecord ROUTINE, NEXT failed')
  60.     EXIT
  61.   ELSE
  62.     LocalResponse = RequestCompleted
  63.     #EMBED(%GetNextRecordNextSucceeds,'GetNextRecord ROUTINE, NEXT succeeds')
  64.   END
  65.   #IF(%PrimaryKey)
  66.   RecordsProcessed += 1
  67.   RecordsThisCycle += 1
  68.   #ELSE
  69.   RecordsProcessed += BYTES(%Primary)
  70.   RecordsThisCycle += BYTES(%Primary)
  71.   #ENDIF
  72.   IF PercentProgress < 100
  73.     PercentProgress = (RecordsProcessed / RecordsToProcess)*100
  74.     IF PercentProgress > 100
  75.       PercentProgress = 100
  76.     END
  77.     IF PercentProgress <> Progress:Thermometer THEN
  78.       Progress:Thermometer = PercentProgress
  79.       ?Progress:PctText{Prop:Text} = FORMAT(PercentProgress,@N3) & '% Completed'
  80.       DISPLAY()
  81.     END
  82.   END
  83.  
  84. #!---------------------------
  85. #GROUP(%ProcessValidateRecord)
  86. !-----------------------------------------------------------------------------
  87. ValidateRecord       ROUTINE
  88.   RecordStatus = Record:OutOfRange
  89.   IF LocalResponse = RequestCancelled THEN EXIT.
  90.   #SUSPEND
  91.   #?RejectRecord = False
  92.   #INSERT(%StandardFormula,'Before Range Check')
  93.   #?IF RejectRecord THEN EXIT.
  94.   #RESUME
  95.   #EMBED(%RecordOutOfRange,'Validate Record: Range Checking')
  96.   #SUSPEND
  97.   #?RecordStatus = Record:Filtered
  98.     #SUSPEND
  99.   #?RejectRecord = False
  100.   #INSERT(%StandardFormula,'Before Filter Check')
  101.   #?IF RejectRecord THEN EXIT.
  102.     #RESUME
  103.     #EMBED(%RecordFilter,'Validate Record: Filter Checking')
  104.   #RESUME
  105.   RecordStatus = Record:OK
  106.   EXIT
  107. #!---------------------------
  108. #GROUP(%ProcessEventTimer)
  109. #INSERT(%StandardFormula,'Before Lookups')
  110. #INSERT(%StandardFormula,'After Lookups')
  111. #EMBED(%ProcessActivity,'Activity for each record')
  112. #CASE(%ProcessAction)
  113. #OF('PUT record')
  114. PUT(%ListView)
  115. IF ERRORCODE()
  116.   IF StandardWarning(Warn:ProcessActionError,'Put','%ListView')
  117.     LocalResponse = RequestCompleted
  118.     BREAK
  119.   END
  120. END
  121. #OF('DELETE record')
  122. DELETE(%ListView)
  123. #ENDCASE
  124. #EMBED(%ProcessError,'Error checking after record Action')